package com.settlement.system.common.util.common;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author author
 */
public class StringMathUtils {

    public static String max(String... strings) {
        if (strings.length == 0) {
            return null;
        }
        String maxStr = strings[0];
        for (int index = 1; index < strings.length; index++) {
            if (maxStr.compareTo(strings[index]) < 0) {
                maxStr = strings[index];
            }
        }
        return maxStr;
    }


    public static String min(String... strings) {
        if (strings.length == 0) {
            return null;
        }
        String minStr = strings[0];
        for (int index = 1; index < strings.length; index++) {
            if (minStr.compareTo(strings[index]) > 0) {
                minStr = strings[index];
            }
        }
        return minStr;
    }

    /**判断数字*/
    private static Pattern patterNumer = Pattern.compile("[0-9]+");
    /**
     * 利用正则表达式判断字符串是否是数字
     * @param str
     * @return
     */
    public static boolean isNumeric(String str){
        Matcher isNum = patterNumer.matcher(str);
        return isNum.matches();
    }

    public static void main(String[] args) {
        System.out.println(!isNumeric(""));
    }

}
